#pragma once

namespace col 
{

class XmlUtils
{
public:
	/*! @brief Finds a node from inside the parent node.
	 *
	 * @note This function only searches for the first positive match
	 *       so if there are many nodes with the same name then
	 *       use FindNodes.
	 *
	 * @param pParent The parent node.
	 * @param rName The name of the node that is being searched. 
	 *              The comparison is case-sensitive.
	 * @return The found node or zero if it was not found.
	 **/
	static const wxXmlNode *FindNode ( const wxXmlNode *pParent, 
		const wxString &rName );

	typedef std::deque < const wxXmlNode * > XmlNodePtrDeque;

	//! Same as FindNode but finds all nodes with the given name instead of only the first one.
	static const XmlNodePtrDeque FindNodes ( const wxXmlNode *pParent,
		const wxString &rName );

	/*! @brief A helper function to get the content of the node.
	 *
	 * @param pNode The node from which the content is returned.
	 * @return The node content or an empty string if the node was null.
	 **/
	static const wxString GetNodeContent ( const wxXmlNode *pNode );

	static const wxString GetNodeContent ( const wxXmlNode *pRoot,
		const wxString &rName );

	static const wxString GetNodeAttribute ( const wxXmlNode *pNode,
		const wxString &rPropName );

	static wxUint32 GetItemCount ( const wxXmlDocument &rFromDoc,
		const wxString &rNodeName );
};

}